{	Problem: http://codeforces.ru/problemset/problem/92/B
	Verdict: Accepted
}
uses
        SysUtils, Math;

var
        ans,i,ls:int64;
        s:string;

function BinToInt(B:string):Int64;
var i:byte; k:longint;
begin
result:=0;
k:=length(b);
for i:=1 to k do result:=(result shl 1)+(byte(B[i]) and 1);
end;
                
begin 
readln(s);
ans:=0;
ls:=length(s);
while ls>1 do begin
        if s[ls]='0' then delete(s,ls,1) else begin
                i:=ls;
                while (s[i]='1') and (i>1) do begin
                        s[i]:='0';
                        dec(i);
                end;
                if s[i]='0' then s[i]:='1' else begin
                        s[i]:='0';
                        s:='1'+s;
                end;
        end;
        inc(ans);
        ls:=length(s);
end;
write(ans);
end.